<template>
  <div class="equipment_item">
    <div class="col">
      <p class="item item_black ellipsis">
        {{ data.deviceName || '-' }}
      </p>
      <p class="item">
        <van-icon name="info-o" style="margin-right: 4px" />{{
          (data.endTime && data.endTime.split(' ')[0]) || '-'
        }}
      </p>
    </div>
    <div class="col">
      <p class="item item_black ellipsis">{{ data.taskName || '-' }}</p>
      <p class="item ellipsis">{{ data.installLocationName || '-' }}</p>
    </div>
    <div class="col col_state">
      <div>
        <p
          style="display: inline-block"
          class="item item_state"
          :class="data.state == 1 ? 'item_state1' : 'item_state2'"
        >
          {{ data.hasDelayed ? '已延期' : '待执行' }}
        </p>
      </div>
      <p class="item item_black">
        {{ data.val || '开始任务' }}
        <!-- <img class="scan" :src="scan" alt="" /> -->
      </p>
    </div>
  </div>
</template>

<script setup>
import scan from '@/assets/images/scan.png';
const props = defineProps({
  icon: {
    type: String,
    required: '',
  },
  data: {
    type: Object,
    default: () => {
      return {};
    },
  },
});
// 定义 emits
const emit = defineEmits(['handleItem']);

function handleItem(item) {
  emit('handleItem', item);
}
</script>

<style lang="scss" scoped>
.equipment_item {
  padding-top: 12px;
  padding-left: 12px;
  display: flex;
  width: 100%;
  justify-content: space-between;
  border-bottom: 1px solid #d9d9d9;
  font-weight: bold;

  .col {
    width: 33%;
  }

  .item {
    height: 40px;
    line-height: 40px;
    font-weight: 400;
    font-size: 13px;
    color: #666666;
    max-width: 100%;
  }

  .item_black {
    color: #333333;
    font-size: 14px;
  }

  .col_state {
    text-align: center;
  }
  .item_state {
    width: 80px;
    text-align: center;
    border-radius: 21px;
  }
  .item_state1 {
    background-color: rgba(19, 15, 12, 0.1);
    color: #ed6a0c;
  }
  .item_state2 {
    background-color: rgba(10, 146, 254, 0.1);
    color: #0a92fe;
  }

  .scan {
    width: 12px;
    height: 12px;
  }
}
</style>
